import React from "react";
import {
  Text,
  Button,
  Alert,
  Image,
  ScrollView,
  TextInput,
  TouchableOpacity,
  ImageBackground,
  StyleSheet,
  Dimensions,
  View,
} from "react-native";

//获取设备的宽高
const width=Dimensions.get('window').width;
const height = Dimensions.get("window").height;


class Demo1 extends React.Component{
  render() {
    return (
      <ScrollView>
        <TextInput style={styles.input}></TextInput>
        <Image source={{uri:'https://reactnative.dev/docs/assets/p_cat1.png'}} style={styles.img}/>
        {/*放在Android里，使用命令 切换到android目录执行gradlew clean*/}
        <Image source={{uri:'img1'}} style={styles.img}/>
        <Image source={{uri:'img1'}} style={styles.img}/>
        <ImageBackground source={{uri:'menu_head'}} style={styles.img}>
          <View style={styles.text}>
            <Text>你好</Text>
          </View>
        </ImageBackground>
        <TextInput placeholder={"请输入"} underlineColorAndroid={'transparent'} secureTextEntry={true}/>
        <Text style={{ fontSize: 96 }}>Scrolling down</Text>
        <Text style={{ fontSize: 96 }}>Scrolling down</Text>
        <Text style={{ fontSize: 96 }}>Scrolling down</Text>
        <Button title={'点击'} onPress={()=>{
          Alert.prompt("你点击了")
        }}/>
        <TouchableOpacity><Text>你好</Text></TouchableOpacity>
      </ScrollView>
    );
  }
}
const styles=StyleSheet.create({
  input:{
    borderWidth:1,
    borderColor:'red',
    marginTop:20
  },
  img:{
    width:200,
    height:200
  },
  text:{
    width:'100%',
    height:'100%',
    justifyContent:'center',
    alignItems:'center'
  }
})
export default Demo1
